package com.banmoon.observer;

import cn.hutool.core.util.StrUtil;

public class SinaWebsite implements Observer{

    private int temperature;

    private int pressure;

    private int humidity;

    @Override
    public void update(int temperature, int pressure, int humidity) {
        this.temperature = temperature;
        this.pressure = pressure;
        this.humidity = humidity;
        showData();
    }

    @Override
    public void showData() {
        System.out.println("========== 新浪天气 ==========");
        System.out.println(StrUtil.format("~~~ 温度：{} ~~~", this.temperature));
        System.out.println(StrUtil.format("~~~ 气压：{} ~~~", this.pressure));
        System.out.println(StrUtil.format("~~~ 湿度：{} ~~~", this.humidity));
    }
}
